#pragma ident "$Id: Ambiguity.cpp 2596 2011-12-08 17:22:04Z shjzhang $"

/**
 * @file Ambiguity.cpp
 * Class to define and handle the edge of the 'observed' network.
 */

//============================================================================
//
//  Copyright
//
//  add ambiArc for this class
//  2019/09/10, shjzhang
//
//  Shoujian Zhang - School of Geodesy and Geomatics, Wuhan University, 2011
//
//============================================================================

#include <set>
#include <map>
#include <list>
#include <queue>
#include <vector>

#include "Ambiguity.hpp"

namespace gpstk
{

       /// Copy constructor.
    Ambiguity::Ambiguity(const Ambiguity &amb)
       noexcept(false)
    {
       ambiSource = amb.ambiSource;
       ambiSat = amb.ambiSat;
       ambiArc = amb.ambiArc;
       ambiType = amb.ambiType;
    }


       /// Assignment operator.
    Ambiguity& Ambiguity::operator=(const Ambiguity& right)
       throw()
    {
       ambiSource = right.ambiSource;
       ambiSat = right.ambiSat;
       ambiArc = right.ambiArc;
       ambiType = right.ambiType;
       return (*this);
    }


       /// This ordering is required to be able
       /// to use a Ambiguity as an index to a std::map, or as part of a
       /// std::set.
    bool Ambiguity::operator<(const Ambiguity& right) const
    {
       if(ambiType==right.getType())
       {
              // Compare each field in turn
           if ( ambiSource == right.getSource() )
           {
               if( ambiSat == right.getSatellite())
               {
                   return ( ambiArc < right.getArc() );
               }
               else
               {
                   return ( ambiSat < right.getSatellite() );
               }
           }
           else
           {
              return ( ambiSource < right.getSource() );
           }
       }
       else
       {
           return ( ambiType < right.getType() );
       }

    }

       /// Equality operator
    bool Ambiguity::operator==(const Ambiguity& right) const
    {
       return( ambiSource == right.getSource()    &&
               ambiSat    == right.getSatellite() &&
               ambiArc    == right.getArc()       &&
               ambiType    == right.getType()    
               );
    }


}  // End of namespace gpstk
